/*
 * RSFactory.java
 *
 * Created on March 28, 2007, 10:44 PM
 *
 * This class should be used to retrieve different Revenue Source DAOs
 * based on what is being passed in (the parameter) to the method. This class communicates
 * the gui to know which DAO to access
 */

package edu.byu.isys413.mystuff;
import edu.byu.isys413.mystuff.sales.*;
import java.util.Map;
import java.util.TreeMap;

/**
 *
 * @author Gabe
 */
public class RSFactory {
     ///////////////////////////////////////
    ///   Singleton pattern
    
    private static RSFactory instance = null;
   
    public static synchronized RSFactory getInstance() {
        if (instance == null) {
            instance = new RSFactory();
        }
        return instance;
    } 
    private String sku = "";
   
    //Create a Map to store revsource DAO
    private Map FactoryMap = new TreeMap();
    
    /** Creates a new instance of RSFactory */
    public RSFactory() {
        
        //FactoryMap.put(first, SalesDAO.getInstance());
        FactoryMap.put("Sale", SalesDAO.getInstance());
        //FactoryMap.put("Backup", BackupDAO.getInstance());
        //FactoryMap.put("Rental", RentalDAO.getInstance());
        //FactoryMap.put("Conversion", PhotoDAO.getInstance());
    }
    
   
    
    public revaDAO getDAO(String type){
        return (revaDAO)FactoryMap.get(type);
    }
    
    
    
}
